package com.enfi.api.modules.db.entity;

import lombok.*;
import org.hibernate.annotations.*;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * (WarningConfig)实体类
 *
 * @author wind
 * @since 2020-04-07 15:56:42
 */
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name="t_tbl_warning_config")
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate
public class WarningConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    /**
     * 预警来源 1污水生产预警 2污水水质预警 3供水生产预警 4供水水质预警 5管网预警
     */    
    private Integer source;

    /**
     * 子公司编码
     */    
    private String officeCode;

    /**
     * 子公司名称
     */    
    private String officeName;

    /**
     * 工厂编码
     */    
    private String factoryCode;

    /**
     * 工厂名字
     */    
    private String factory;

    /**
     * 预警等级 1一级 2二级 3三级 4四级
     */    
    private Integer level;

    /**
     * 推送方式 1pc推送 2app推送 3短信
     */    
    private Integer pushWay;

    /**
     * 推送平台 1集成平台 2集成app 3领导pad 4巡检app
     */    
    private Integer platform;

    /**
     * 角色名称集合
     */    
    private String roleNames;

    /**
     * 状态 0禁用 1启用
     */    
    private Integer status;

    /**
     * 创建时间
     */    
    private Date createTime;

    /**
     * 修改时间
     */    
    private Date updateTime;

    /**
     * 创建人ID
     */    
    private String createUserId;

    /**
     * 修改人ID
     */    
    private String updateUserId;

    @NotFound(action = NotFoundAction.IGNORE)
    @OneToMany(fetch = FetchType.LAZY,targetEntity = WarningConfigRole.class,cascade = {CascadeType.ALL})
    @Fetch(value = FetchMode.JOIN)
    @JoinColumn(name = "warningConfigId")
    private List<WarningConfigRole> warningConfigRoleList;

}